package com.common.framework.util;

import com.common.framework.constant.Constants;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Random;

/**
 * @author hejianglong
 * @date 2019/10/24
 */
public class Util {

    private static final Random RANDOM = new Random();

    /**
     * 获取验证码
     * @return
     */
    public static String getPhoneAuthCode() {
        return String.valueOf(100000 + RANDOM.nextInt(999999 - 100000));
    }

    /**
     * 返回默认昵称
     * @param phone
     * @return
     */
    public static String getDefaultNickName(@NotNull Long phone) {
        return String.valueOf(phone).substring(0, 5).concat("***");
    }
}
